<template><div><p>本文档最新版为 <a href="https://learnku.com/docs/laravel/10.x" target="_blank" rel="noopener noreferrer">10.x</a>，旧版本可能放弃维护，推荐阅读最新版！</p>
<h2 id="laravel-虚拟开发环境-homestead" tabindex="-1"><a class="header-anchor" href="#laravel-虚拟开发环境-homestead"><span>Laravel 虚拟开发环境 Homestead</span></a></h2>
<ul>
<li><a href="#introduction">简介</a></li>
<li><a href="#installation-and-setup">安装与设置</a>
<ul>
<li><a href="#first-steps">第一步</a></li>
<li><a href="#configuring-homestead">配置 Homestead</a></li>
<li><a href="#launching-the-vagrant-box">启动 Vagrant Box</a></li>
<li><a href="#per-project-installation">根据项目安装</a></li>
<li><a href="#installing-mariadb">安装 MariaDB</a></li>
</ul>
</li>
<li><a href="#daily-usage">常见用法</a>
<ul>
<li><a href="#accessing-homestead-globally">全局可用的 Homestead</a></li>
<li><a href="#connecting-via-ssh">通过 SSH 连接</a></li>
<li><a href="#connecting-to-databases">连接数据库</a></li>
<li><a href="#adding-additional-sites">增加更多网站</a></li>
<li><a href="#configuring-cron-schedules">配置 Cron 调度器</a></li>
<li><a href="#ports">端口</a></li>
<li><a href="#sharing-your-environment">共享你的环境</a></li>
<li><a href="#multiple-php-versions">多个 PHP 版本</a></li>
</ul>
</li>
<li><a href="#network-interfaces">网络接口</a></li>
<li><a href="#updating-homestead">更新 Homestead</a></li>
<li><a href="#old-versions">历史版本</a></li>
<li><a href="#provider-specific-settings">提供器的特殊设置</a>
<ul>
<li><a href="#provider-specific-virtualbox">VirtualBox</a></li>
</ul>
</li>
</ul>
<h2 id="简介" tabindex="-1"><a class="header-anchor" href="#简介"><span>简介</span></a></h2>
<p>Laravel 努力使整个 PHP 开发体验更加愉快，包括你的本地开发环境。<a href="https://www.vagrantup.com/" target="_blank" rel="noopener noreferrer">Vagrant</a> 提供了一种简单、优雅的方式来管理和配置虚拟机。</p>
<p>Laravel Homestead 是一个官方预封装的 Vagrant Box，它为你提供了一个完美的开发环境，你无需在本地安装 PHP 、web 服务器或任何服务软件。 Vagrant Box 是完全一次性的，不用担心会搞乱你的操作系统！如果有什么地方出错了，你可以在几分钟内销毁并重建该 Box ！</p>
<p>Homestead 可以在任何 Windows、Mac 或 Linux 系统上运行，它包括了 Nginx Web 服务器、PHP 7.1、MySQL、PostgresSQL、Redis、Memcached、Node 以及开发 laravel 应用所需的东西。</p>
<blockquote>
<p>{note} 如果你使用的是 Windows，你可能需要通过 BIOS 来启用硬件虚拟化（VT-x）。如果你在 UEFI 系统上使用 Hyper-V，可能还需要禁用 Hyper-V 才能启用 VT-x。</p>
</blockquote>
<h3 id="内置软件" tabindex="-1"><a class="header-anchor" href="#内置软件"><span>内置软件</span></a></h3>
<ul>
<li>Ubuntu 16.04</li>
<li>Git</li>
<li>PHP 7.1</li>
<li>Nginx</li>
<li>MySQL</li>
<li>MariaDB</li>
<li>Sqlite3</li>
<li>Postgres</li>
<li>Composer</li>
<li>Node (带有 Yarn、Bower、Grunt 和 Gulp)</li>
<li>Redis</li>
<li>Memcached</li>
<li>Beanstalkd</li>
<li>Mailhog</li>
<li>ngrok</li>
</ul>
<h2 id="安装与设置" tabindex="-1"><a class="header-anchor" href="#安装与设置"><span>安装与设置</span></a></h2>
<h3 id="第一步" tabindex="-1"><a class="header-anchor" href="#第一步"><span>第一步</span></a></h3>
<p>在启动 Homestead 环境之前，你必须先安装 <a href="https://www.virtualbox.org/wiki/Downloads" target="_blank" rel="noopener noreferrer">VirtualBox 5.1</a>／<a href="https://www.vmware.com/" target="_blank" rel="noopener noreferrer">VMWare</a>／<a href="http://www.parallels.com/products/desktop/" target="_blank" rel="noopener noreferrer">Parallels</a> 以及 <a href="https://www.vagrantup.com/downloads.html" target="_blank" rel="noopener noreferrer">Vagrant</a>。上述软件均针对不同操作系统提供了易于使用的可视化安装包。</p>
<p>若要使用 VMware 提供器，你需要同时购买 VMware Fusion／Workstation 以及 <a href="https://www.vagrantup.com/vmware" target="_blank" rel="noopener noreferrer">VMware Vagrant 插件</a>。尽管 VMware 不是免费的，但 VMware 可以提供更快的共享文件夹性能。</p>
<p>若要使用 Parallels 提供器，你需要安装 <a href="https://github.com/Parallels/vagrant-parallels" target="_blank" rel="noopener noreferrer">Parallels Vagrant 插件</a>。这是免费的。</p>
<h4 id="安装-homestead-vagrant-box" tabindex="-1"><a class="header-anchor" href="#安装-homestead-vagrant-box"><span>安装 Homestead Vagrant Box</span></a></h4>
<p>当安装完 VirtualBox／VMware 以及 Vagrant 后，你可以在终端使用下面的命令将 <code v-pre>laravel/homestead</code> Box 添加到 Vagrant 中安装。下载 Box 需要几分钟的时间，具体取决于你的互联网连接速度：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">vagrant box add laravel<span class="token operator">/</span>homestead</span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><p>如果上面的命令运行失败，请确保你的 Vagrant 是最新版本的 。</p>
<blockquote>
<p>{tip} 国内网络的下载速度不是一般的慢。可另寻解决之道。</p>
</blockquote>
<h4 id="安装-homestead" tabindex="-1"><a class="header-anchor" href="#安装-homestead"><span>安装 Homestead</span></a></h4>
<p>你可以简单使用 Git 克隆代码库来安装 Homestead。建议将代码库克隆到用户「home」目录下的 <code v-pre>Homestead</code> 文件夹中。这样 Homestead Box 就可以作为所有 Laravel 项目的主机：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">cd <span class="token operator">~</span></span>
<span class="line">git <span class="token keyword">clone</span> https<span class="token punctuation">:</span><span class="token comment">//github.com/laravel/homestead.git Homestead</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div></div></div><p>由于 Homestead 的 <code v-pre>master</code> 分支并不是稳定分支，你应该用打过标签的稳定版本。你可以在 <a href="https://github.com/laravel/homestead/releases" target="_blank" rel="noopener noreferrer">Github 发行页面</a> 上找到最新的稳定版本。</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">cd Homestead</span>
<span class="line"></span>
<span class="line"><span class="token comment">// Clone the desired release...</span></span>
<span class="line">git checkout v6<span class="token operator">.</span><span class="token number">1.0</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>克隆 Homestead 代码库后，从 Homestead 目录中运行 <code v-pre>bash init.sh</code> 命令来创建 <code v-pre>Homesstead.yaml</code> 配置文件。 <code v-pre>Homesstead.yaml</code> 文件会被放置在你的 Homestead 目录中：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"><span class="token comment">// Mac / Linux...</span></span>
<span class="line">bash init<span class="token operator">.</span>sh</span>
<span class="line"></span>
<span class="line"><span class="token comment">// Windows...</span></span>
<span class="line">init<span class="token operator">.</span>bat</span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h3 id="配置-homestead" tabindex="-1"><a class="header-anchor" href="#配置-homestead"><span>配置 Homestead</span></a></h3>
<h4 id="配置提供器" tabindex="-1"><a class="header-anchor" href="#配置提供器"><span>配置提供器</span></a></h4>
<p><code v-pre>Homestead.yaml</code> 中的 <code v-pre>provider</code> 参数设置决定了你用的是哪一个 Vagrant 提供器：<code v-pre>virtualbox</code>、<code v-pre>vmware_fusion</code>、<code v-pre>vmware_workstation</code> 或者 <code v-pre>parallels</code>。你可以根据自己的喜好来设置提供器：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">provider<span class="token punctuation">:</span> virtualbox</span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><h4 id="配置共享文件夹" tabindex="-1"><a class="header-anchor" href="#配置共享文件夹"><span>配置共享文件夹</span></a></h4>
<p><code v-pre>Homestead.yaml</code> 文件的 <code v-pre>folders</code> 属性里列出所有与 Homestead 环境共享的文件夹。这些文件夹中的文件若有变更，它们会保持本地机器与 Homestead 环境之间同步。你可以根据需要配置多个共享文件夹：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">folders<span class="token punctuation">:</span></span>
<span class="line">    <span class="token operator">-</span> map<span class="token punctuation">:</span> <span class="token operator">~</span><span class="token operator">/</span>Code</span>
<span class="line">      to<span class="token punctuation">:</span> <span class="token operator">/</span>home<span class="token operator">/</span>vagrant<span class="token operator">/</span>Code</span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>若要启动 <a href="https://www.vagrantup.com/docs/synced-folders/nfs.html" target="_blank" rel="noopener noreferrer">NFS</a>，只需要在共享的文件夹配置中添加一个简单的标志：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">folders<span class="token punctuation">:</span></span>
<span class="line">    <span class="token operator">-</span> map<span class="token punctuation">:</span> <span class="token operator">~</span><span class="token operator">/</span>Code</span>
<span class="line">      to<span class="token punctuation">:</span> <span class="token operator">/</span>home<span class="token operator">/</span>vagrant<span class="token operator">/</span>Code</span>
<span class="line">      type<span class="token punctuation">:</span> <span class="token string double-quoted-string">"nfs"</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><blockquote>
<p>{note} 使用 NFS 时，建议你安装 <a href="https://github.com/gael-ian/vagrant-bindfs" target="_blank" rel="noopener noreferrer">vagrant-bindfs</a> 插件。这个插件会替你处理 Homestead Box 中的文件或目录权限问题。</p>
</blockquote>
<p>你也可以通过在 <code v-pre>options</code> 下方列出 Vagrant 的 <a href="https://www.vagrantup.com/docs/synced-folders/basic_usage.html" target="_blank" rel="noopener noreferrer">共享文件夹</a> 支持的任何选项：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">folders<span class="token punctuation">:</span></span>
<span class="line">    <span class="token operator">-</span> map<span class="token punctuation">:</span> <span class="token operator">~</span><span class="token operator">/</span>Code</span>
<span class="line">      to<span class="token punctuation">:</span> <span class="token operator">/</span>home<span class="token operator">/</span>vagrant<span class="token operator">/</span>Code</span>
<span class="line">      type<span class="token punctuation">:</span> <span class="token string double-quoted-string">"rsync"</span></span>
<span class="line">      options<span class="token punctuation">:</span></span>
<span class="line">          rsync__args<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string double-quoted-string">"--verbose"</span><span class="token punctuation">,</span> <span class="token string double-quoted-string">"--archive"</span><span class="token punctuation">,</span> <span class="token string double-quoted-string">"--delete"</span><span class="token punctuation">,</span> <span class="token string double-quoted-string">"-zz"</span><span class="token punctuation">]</span></span>
<span class="line">          rsync__exclude<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token string double-quoted-string">"node_modules"</span><span class="token punctuation">]</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h4 id="配置-nginx-站点" tabindex="-1"><a class="header-anchor" href="#配置-nginx-站点"><span>配置 Nginx 站点</span></a></h4>
<p>对 Nginx 不熟悉吗？没关系。<code v-pre>sites</code> 属性可以帮助你可以轻松地将 <code v-pre>域名</code> 映射到 homestead 环境中的文件夹。<code v-pre>Homestead.yaml</code> 文件中已包含示例站点配置。同样的，你也可以增加多个站点到你的 Homestead 环境中。 Homestead 可以同时为多个 Laravel 应用提供虚拟化环境：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">sites<span class="token punctuation">:</span></span>
<span class="line">    <span class="token operator">-</span> map<span class="token punctuation">:</span> homestead<span class="token operator">.</span>app</span>
<span class="line">      to<span class="token punctuation">:</span> <span class="token operator">/</span>home<span class="token operator">/</span>vagrant<span class="token operator">/</span>Code<span class="token operator">/</span>Laravel<span class="token operator">/</span><span class="token keyword">public</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>如果你在配置 Homestead Box 之后更改了 <code v-pre>sites</code> 属性，那么应该重新运行 <code v-pre>vagrant reload --provision</code> 来更新虚拟机上的 Nginx 配置。</p>
<h4 id="关于-hosts-文件" tabindex="-1"><a class="header-anchor" href="#关于-hosts-文件"><span>关于 Hosts 文件</span></a></h4>
<p>你必须将在 Nginx 站点中所添加的「域名」也添加到你机器的 <code v-pre>hosts</code> 上。 <code v-pre>hosts</code> 文件会将 Homestead 站点的请求重定向到 Homestead Box 中。在 Mac 或 Linux 上，该文件位于 <code v-pre>/etc/hosts</code>。在 Windows 上，它位于 <code v-pre>C:\Windows\System32\drivers\etc\hosts</code>。添加的内容如下所示：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"><span class="token number">192.168</span><span class="token number">.10</span><span class="token number">.10</span>  homestead<span class="token operator">.</span>app</span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><p>请确保列出的 IP 地址是你 <code v-pre>Homestead.yaml</code> 文件中的 IP 地址。将域名设置到 <code v-pre>hosts</code> 文件并启动 Vagrant Box后，你就可以通过 Web 浏览器访问该站点：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">http<span class="token punctuation">:</span><span class="token comment">//homestead.app</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><h3 id="启动-vagrant-box" tabindex="-1"><a class="header-anchor" href="#启动-vagrant-box"><span>启动 Vagrant Box</span></a></h3>
<p>根据你的喜好完成 <code v-pre>Homestead.yaml</code> 的编辑后，再从 Homestead 目录运行 <code v-pre>vagrant up</code> 命令。Vagrant 将启动虚拟机并自动配置你的共享文件夹和 Nginx 站点。</p>
<p>如果要删除虚拟机，使用 <code v-pre>vagrant destroy --force</code> 命令。</p>
<h3 id="根据项目安装" tabindex="-1"><a class="header-anchor" href="#根据项目安装"><span>根据项目安装</span></a></h3>
<p>除了全局安装 Homestead 并且在所有项目共享相同的 Homestead Box 外，你可以为每个项目配置 Homestead 实例。通过在项目下创建 <code v-pre>Vagrantfile</code>，可以实现为每个项目分别安装上 Homestead ，其他项目成员只需要简单地运行 <code v-pre>vagrant up</code> 就能都拥有同样的开发环境。</p>
<p>要将 Homestead 直接安装到项目中，需要使用 Composer:</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">composer <span class="token keyword">require</span> laravel<span class="token operator">/</span>homestead <span class="token operator">--</span>dev</span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><p>Homestead 安装完后，可以使用 <code v-pre>make</code> 命令在项目根目录中生成 <code v-pre>Vagrantfile</code> 与 <code v-pre>Homestead.yaml</code> 文件。<code v-pre>make</code> 命令会自动配置 Homestead.yaml 文件中的 <code v-pre>sites</code> 及 <code v-pre>folders</code> 指令。</p>
<p>Mac/Linux:</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">php vendor<span class="token operator">/</span>bin<span class="token operator">/</span>homestead make</span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><p>Windows:</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">vendor\\bin\\homestead make</span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><p>接下来，在终端中运行 <code v-pre>vagrant up</code> 并在浏览器中访问你的项目 <code v-pre>http://homestead.app</code>。再次提醒：你仍然需要在 <code v-pre>/etc/hosts</code> 里配置 <code v-pre>homestead.app</code> 或其它想要使用的域名。</p>
<h3 id="安装-mariadb" tabindex="-1"><a class="header-anchor" href="#安装-mariadb"><span>安装 MariaDB</span></a></h3>
<p>如果你喜欢使用 MariaDB 而不是 MySQL，你可以在 <code v-pre>Homestead.yaml</code> 文件中增加一个 <code v-pre>mariadb</code> 的选项。这个选项会删除 MySQL 并安装 MariaDB。MariaDB 只是作为 MySQL 的替代品，因此你还是可以在应用的数据库配置中使用 <code v-pre>mysql</code> 数据库驱动：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">box<span class="token punctuation">:</span> laravel<span class="token operator">/</span>homestead</span>
<span class="line">ip<span class="token punctuation">:</span> <span class="token string double-quoted-string">"192.168.20.20"</span></span>
<span class="line">memory<span class="token punctuation">:</span> <span class="token number">2048</span></span>
<span class="line">cpus<span class="token punctuation">:</span> <span class="token number">4</span></span>
<span class="line">provider<span class="token punctuation">:</span> virtualbox</span>
<span class="line">mariadb<span class="token punctuation">:</span> <span class="token constant boolean">true</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="常见用法" tabindex="-1"><a class="header-anchor" href="#常见用法"><span>常见用法</span></a></h2>
<h3 id="全局使用" tabindex="-1"><a class="header-anchor" href="#全局使用"><span>全局使用</span></a></h3>
<p>如果你想在系统的任何地方都可以使用 <code v-pre>vagrant up</code> 命令启动 Homestead，你可以在 Mac / Linux 系统的 Bash 配置文件中添加 Bash 函数。在 Windows 中，你可以通过在 <code v-pre>PATH</code> 环境变量中添加一个「批处理」文件来实现。下面这些脚本使你可以从系统的任何地方运行任何 Vagrant 命令，并将自动将该命令指向你的 Homestead 安装路径：</p>
<h4 id="mac-linux" tabindex="-1"><a class="header-anchor" href="#mac-linux"><span>Mac / Linux</span></a></h4>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"><span class="token keyword">function</span> <span class="token function-definition function">homestead</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span></span>
<span class="line">    <span class="token punctuation">(</span> cd <span class="token operator">~</span><span class="token operator">/</span>Homestead <span class="token operator">&amp;&amp;</span> <span class="token class-name type-declaration">vagrant</span> $<span class="token operator">*</span> <span class="token punctuation">)</span></span>
<span class="line"><span class="token punctuation">}</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>确保将该功能中的 <code v-pre>~/Homestead</code> 路径是你实际的 Homestead 安装路径。这样你就可以在系统的任何地方运行 <code v-pre>homestead up</code> 或 <code v-pre>homestead ssh</code> 等命令。</p>
<h4 id="windows" tabindex="-1"><a class="header-anchor" href="#windows"><span>Windows</span></a></h4>
<p>在系统的任意位置创建一个批处理文件 <code v-pre>homestead.bat</code> ，并添加如下内容：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">@<span class="token keyword">echo</span> off</span>
<span class="line"></span>
<span class="line">set cwd<span class="token operator">=</span><span class="token operator">%</span>cd<span class="token operator">%</span></span>
<span class="line">set homesteadVagrant<span class="token operator">=</span><span class="token constant">C</span><span class="token punctuation">:</span>\Homestead</span>
<span class="line"></span>
<span class="line">cd <span class="token operator">/</span>d <span class="token operator">%</span>homesteadVagrant<span class="token operator">%</span> <span class="token operator">&amp;&amp;</span> vagrant <span class="token operator">%</span><span class="token operator">*</span></span>
<span class="line">cd <span class="token operator">/</span>d <span class="token operator">%</span>cwd<span class="token operator">%</span></span>
<span class="line"></span>
<span class="line">set cwd<span class="token operator">=</span></span>
<span class="line">set homesteadVagrant<span class="token operator">=</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>请确保将例子中 <code v-pre>C:\Homestead</code> 这个路径修改为你的实际 Homestead 的安装路径。创建文件后，将文件位置添加到环境变量 <code v-pre>PATH</code> 中。然后就可以在系统的任意位置运行 <code v-pre>homestead up</code> 或 <code v-pre>homestead ssh</code> 命令。</p>
<h3 id="通过-ssh-连接" tabindex="-1"><a class="header-anchor" href="#通过-ssh-连接"><span>通过 SSH 连接</span></a></h3>
<p>你可以通过在 Homestead 目录运行 <code v-pre>vagrant ssh</code> 命令来连接虚拟主机。</p>
<p>你可能需要频繁地使用 SSH 连接 Homestead 主机，可以尝试着利用上述「功能」来快速地使用 SSH 连接 Homestead Box 。</p>
<h3 id="连接数据库" tabindex="-1"><a class="header-anchor" href="#连接数据库"><span>连接数据库</span></a></h3>
<p>在 Box 中已经为 MySQL 和 Postgres 配置好了一个数据库 <code v-pre>homestead</code>。为了更方便的使用它，Laravel 中的 <code v-pre>.env</code> 文件将框架配置成默认使用此数据库。</p>
<p>要从主机的数据库客户端连接到 MySQL 或 Postgres，就连接到 <code v-pre>127.0.0.1</code> 和端口 <code v-pre>33060</code> (MySQL) 或 <code v-pre>54320</code> (Postgres)。账号密码分别是 <code v-pre>homestead</code>／<code v-pre>secret</code></p>
<blockquote>
<p>{note} 从主机连接到数据库时，只能使用这些非标准端口。 而 Laravel 在虚拟机中运行时，仍旧使用 Laravel 数据库配置文件中的默认 3306 和 5432 端口。</p>
</blockquote>
<h3 id="增加更多网站" tabindex="-1"><a class="header-anchor" href="#增加更多网站"><span>增加更多网站</span></a></h3>
<p>Homestead 环境配置完毕且成功运行后，你可能会想要为 Laravel 应用程序增加其他的 Nginx 站点。你可以在单个 Homestead 环境中运行多个 Laravel 程序。要添加其他网站，只需将网站配置信息添加到 <code v-pre>Homestead.yaml</code> 文件中：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">sites<span class="token punctuation">:</span></span>
<span class="line">    <span class="token operator">-</span> map<span class="token punctuation">:</span> homestead<span class="token operator">.</span>app</span>
<span class="line">      to<span class="token punctuation">:</span> <span class="token operator">/</span>home<span class="token operator">/</span>vagrant<span class="token operator">/</span>Code<span class="token operator">/</span>Laravel<span class="token operator">/</span><span class="token keyword">public</span></span>
<span class="line">    <span class="token operator">-</span> map<span class="token punctuation">:</span> another<span class="token operator">.</span>app</span>
<span class="line">      to<span class="token punctuation">:</span> <span class="token operator">/</span>home<span class="token operator">/</span>vagrant<span class="token operator">/</span>Code<span class="token operator">/</span>another<span class="token operator">/</span><span class="token keyword">public</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>如果 Vagrant 没有自动管理你的「hosts」文件，你可能需要手动把新增的站点加入到该文件中：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line"><span class="token number">192.168</span><span class="token number">.10</span><span class="token number">.10</span>  homestead<span class="token operator">.</span>app</span>
<span class="line"><span class="token number">192.168</span><span class="token number">.10</span><span class="token number">.10</span>  another<span class="token operator">.</span>app</span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div></div></div><p>添加站点后，从 Homestead 目录运行 <code v-pre>vagrant reload --provision</code> 命令就可以应用新的更改。</p>
<h4 id="站点类型" tabindex="-1"><a class="header-anchor" href="#站点类型"><span>站点类型</span></a></h4>
<p>Homestead 支持多种类型的站点，可以让你轻松地运行那些不基于 Laravel 的项目。 例如，我们可以使用 <code v-pre>symfony2</code> 站点类型轻松地在 Homestead 中添加 Symfony 应用程序：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">sites<span class="token punctuation">:</span></span>
<span class="line">    <span class="token operator">-</span> map<span class="token punctuation">:</span> symfony2<span class="token operator">.</span>app</span>
<span class="line">      to<span class="token punctuation">:</span> <span class="token operator">/</span>home<span class="token operator">/</span>vagrant<span class="token operator">/</span>Code<span class="token operator">/</span>Symfony<span class="token operator">/</span>web</span>
<span class="line">      type<span class="token punctuation">:</span> symfony2</span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>支持的站点类型有： <code v-pre>apache</code>、<code v-pre>laravel</code>（默认）、<code v-pre>proxy</code>、<code v-pre>silverstripe</code>、<code v-pre>statamic</code>、<code v-pre>symfony2</code> 和 <code v-pre>symfony4</code>。</p>
<h4 id="站点参数" tabindex="-1"><a class="header-anchor" href="#站点参数"><span>站点参数</span></a></h4>
<p>你还可以使用 <code v-pre>params</code> 站点指令向你的站点添加其他 Nginx <code v-pre>fastcgi_param</code> 值。例如，添加一个值为 <code v-pre>BAR</code> 的 <code v-pre>FOO</code> 参数。</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">sites<span class="token punctuation">:</span></span>
<span class="line">    <span class="token operator">-</span> map<span class="token punctuation">:</span> homestead<span class="token operator">.</span>app</span>
<span class="line">      to<span class="token punctuation">:</span> <span class="token operator">/</span>home<span class="token operator">/</span>vagrant<span class="token operator">/</span>Code<span class="token operator">/</span>Laravel<span class="token operator">/</span><span class="token keyword">public</span></span>
<span class="line">      params<span class="token punctuation">:</span></span>
<span class="line">          <span class="token operator">-</span> key<span class="token punctuation">:</span> <span class="token constant">FOO</span></span>
<span class="line">            value<span class="token punctuation">:</span> <span class="token constant">BAR</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h3 id="配置-cron-调度器" tabindex="-1"><a class="header-anchor" href="#配置-cron-调度器"><span>配置 Cron 调度器</span></a></h3>
<p>Laravel 提供了便利的方式来 <a href="https://learnku.com/docs/laravel/5.5/scheduling" target="_blank" rel="noopener noreferrer">调度 Cron 任务</a>，通过Artisan 命令 <code v-pre>schedule:run</code> ，调度便会在每分钟运行一次。<code v-pre>schedule:run</code> 命令会检查定义在你 <code v-pre>App\Console\Kernel</code> 类中的调度任务，以此判断哪个任务该被运行。</p>
<p>如果你想对 Homestead 站点使用 <code v-pre>schedule:run</code> 命令，你需要在定义站点时将 <code v-pre>schedule</code> 选项设置为 <code v-pre>true</code></p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">sites<span class="token punctuation">:</span></span>
<span class="line">    <span class="token operator">-</span> map<span class="token punctuation">:</span> homestead<span class="token operator">.</span>app</span>
<span class="line">      to<span class="token punctuation">:</span> <span class="token operator">/</span>home<span class="token operator">/</span>vagrant<span class="token operator">/</span>Code<span class="token operator">/</span>Laravel<span class="token operator">/</span><span class="token keyword">public</span></span>
<span class="line">      schedule<span class="token punctuation">:</span> <span class="token constant boolean">true</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>该站点的 Cron 任务会被定义在虚拟机的 <code v-pre>/etc/cron.d</code> 文件夹中。</p>
<h3 id="端口" tabindex="-1"><a class="header-anchor" href="#端口"><span>端口</span></a></h3>
<p>默认情况下，以下端口会被转发至 Homestead 环境：</p>
<ul>
<li><strong>SSH:</strong> 2222 → 发送到 22</li>
<li><strong>HTTP:</strong> 8000 → 发送到 80</li>
<li><strong>HTTPS:</strong> 44300 → 发送到 443</li>
<li><strong>MySQL:</strong> 33060 → 发送到 3306</li>
<li><strong>Postgres:</strong> 54320 → 发送到 5432</li>
<li><strong>Mailhog:</strong> 8025 → 发送到 8025</li>
</ul>
<h4 id="转发更多端口" tabindex="-1"><a class="header-anchor" href="#转发更多端口"><span>转发更多端口</span></a></h4>
<p>你可以根据需要转发更多端口给 Vagrant Box，并指定其协议：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">ports<span class="token punctuation">:</span></span>
<span class="line">    <span class="token operator">-</span> send<span class="token punctuation">:</span> <span class="token number">50000</span></span>
<span class="line">      to<span class="token punctuation">:</span> <span class="token number">5000</span></span>
<span class="line">    <span class="token operator">-</span> send<span class="token punctuation">:</span> <span class="token number">7777</span></span>
<span class="line">      to<span class="token punctuation">:</span> <span class="token number">777</span></span>
<span class="line">      protocol<span class="token punctuation">:</span> udp</span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h3 id="共享你的环境" tabindex="-1"><a class="header-anchor" href="#共享你的环境"><span>共享你的环境</span></a></h3>
<p>有时候你想跟你的同事或者是客户共享你目前在开展的工作。Vagrant 提供了一个内置方法 <code v-pre>vagrant share</code> 来支持。不过，如果你的 <code v-pre>Homestead.yaml</code> 文件中配置了多个站点，就无法使用此命令。</p>
<p>为了解决这个问题，Homestead 提供了自己的 <code v-pre>share</code> 命令。开始之前，通过 <code v-pre>vagrant ssh</code> SSH 命令连接 Homestead 机器中并运行 <code v-pre>share homestead.app</code>。这会从 <code v-pre>Homestead.yaml</code> 配置文件中共享 <code v-pre>homestead.app</code> 站点。你也可以用其他已经配置的站点来代替 <code v-pre>homestead.app</code>。</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">share homestead<span class="token operator">.</span>app</span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><p>运行命令后，你可以看到一个 Ngrok 界面，其中包含活动日志和共享站点的可公开访问的 URL。如果要指定自定义地区或者其他 Ngrok 选项，可以将它们添加到 <code v-pre>share</code> 命令后面：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">share homestead<span class="token operator">.</span>app <span class="token operator">-</span>region<span class="token operator">=</span>eu <span class="token operator">-</span>subdomain<span class="token operator">=</span>laravel</span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><blockquote>
<p>{note} 谨记，Vagrant 本质上是不安全的。当你运行 <code v-pre>share</code> 命令时，你已经在互联网中暴露了你的虚拟机。</p>
</blockquote>
<h3 id="多个-php-版本" tabindex="-1"><a class="header-anchor" href="#多个-php-版本"><span>多个 PHP 版本</span></a></h3>
<blockquote>
<p>{note} 此功能仅与 Nginx 兼容。</p>
</blockquote>
<p>Homestead 6 支持在同一个虚拟机上引入多个版本的 PHP。你可以在 <code v-pre>Homestead.yaml</code> 文件中为给定站点指定使用哪个版本的 PHP。 可用的 PHP 版本有：「5.6」、「7.0」、「7.1」</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">sites<span class="token punctuation">:</span></span>
<span class="line">    <span class="token operator">-</span> map<span class="token punctuation">:</span> homestead<span class="token operator">.</span>app</span>
<span class="line">      to<span class="token punctuation">:</span> <span class="token operator">/</span>home<span class="token operator">/</span>vagrant<span class="token operator">/</span>Code<span class="token operator">/</span>Laravel<span class="token operator">/</span><span class="token keyword">public</span></span>
<span class="line">      php<span class="token punctuation">:</span> <span class="token string double-quoted-string">"5.6"</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>此外，你还可以通过 CLI 使用任何受支持的 PHP 版本：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">php5<span class="token operator">.</span><span class="token number">6</span> artisan <span class="token keyword">list</span></span>
<span class="line">php7<span class="token operator">.</span><span class="token number">0</span> artisan <span class="token keyword">list</span></span>
<span class="line">php7<span class="token operator">.</span><span class="token number">1</span> artisan <span class="token keyword">list</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="网络接口" tabindex="-1"><a class="header-anchor" href="#网络接口"><span>网络接口</span></a></h2>
<p><code v-pre>Homestead.yaml</code> 的 <code v-pre>networks</code> 属性为 Homestead 环境配置网络接口。你可以根据需要配置任意数量的接口：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">networks<span class="token punctuation">:</span></span>
<span class="line">    <span class="token operator">-</span> type<span class="token punctuation">:</span> <span class="token string double-quoted-string">"private_network"</span></span>
<span class="line">      ip<span class="token punctuation">:</span> <span class="token string double-quoted-string">"192.168.10.20"</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>想启用 <a href="https://www.vagrantup.com/docs/networking/public_network.html" target="_blank" rel="noopener noreferrer">桥接</a> 接口，请配置 <code v-pre>bridge</code> 设置，并将网络类型更改为 <code v-pre>public_network</code> ：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">networks<span class="token punctuation">:</span></span>
<span class="line">    <span class="token operator">-</span> type<span class="token punctuation">:</span> <span class="token string double-quoted-string">"public_network"</span></span>
<span class="line">      ip<span class="token punctuation">:</span> <span class="token string double-quoted-string">"192.168.10.20"</span></span>
<span class="line">      bridge<span class="token punctuation">:</span> <span class="token string double-quoted-string">"en1: Wi-Fi (AirPort)"</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>要启用 <a href="https://www.vagrantup.com/docs/networking/public_network.html" target="_blank" rel="noopener noreferrer">DHCP</a>，只需从配置中删除 <code v-pre>ip</code> 选项：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">networks<span class="token punctuation">:</span></span>
<span class="line">    <span class="token operator">-</span> type<span class="token punctuation">:</span> <span class="token string double-quoted-string">"public_network"</span></span>
<span class="line">      bridge<span class="token punctuation">:</span> <span class="token string double-quoted-string">"en1: Wi-Fi (AirPort)"</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="更新-homestead" tabindex="-1"><a class="header-anchor" href="#更新-homestead"><span>更新 Homestead</span></a></h2>
<p>你可以通过两个简单的步骤更新 Homestead。首先，使用 <code v-pre>vagrant box update</code> 命令更新 Vgrant Box :</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">vagrant box update</span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><p>接下来，如果你是通过克隆仓库的方式来安装的 Homestead，你需要更新 Homestead 的源代码。你可以在你最初克隆仓库的位置简单地运行 <code v-pre>git pull origin master</code> 命令。</p>
<p>如果你是通过项目中的 <code v-pre>composer.json</code> 文件安装 Homestead ，则应该确认 <code v-pre>composer.json</code> 文件中包含 <code v-pre>&quot;laravel/homestead: &quot;^6&quot;</code> 并更新依赖：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">composer update</span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><h2 id="历史版本" tabindex="-1"><a class="header-anchor" href="#历史版本"><span>历史版本</span></a></h2>
<blockquote>
<p>{tip} 如果你需要一个旧版本的 PHP，请在尝试使用旧版本的 Homestead 之前，先阅读文档 <a href="#multiple-php-versions">多个 PHP 版本</a> 上的文档。</p>
</blockquote>
<p>你可以通过添加以下内容添加到 <code v-pre>Homestead.yaml</code> 文件中来覆盖 Homestead 使用的 Box 版本:</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">version<span class="token punctuation">:</span> <span class="token number">0.6</span><span class="token number">.0</span></span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div></div></div><p>例如：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">box<span class="token punctuation">:</span> laravel<span class="token operator">/</span>homestead</span>
<span class="line">version<span class="token punctuation">:</span> <span class="token number">0.6</span><span class="token number">.0</span></span>
<span class="line">ip<span class="token punctuation">:</span> <span class="token string double-quoted-string">"192.168.20.20"</span></span>
<span class="line">memory<span class="token punctuation">:</span> <span class="token number">2048</span></span>
<span class="line">cpus<span class="token punctuation">:</span> <span class="token number">4</span></span>
<span class="line">provider<span class="token punctuation">:</span> virtualbox</span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>当你使用较旧版本的 Homestead Box 时，你需要确保将其与 Homestead 源代码的兼容版本进行匹配。下面的图表展示了支持的 Box 版本，使用哪个版本的 Homestead 源代码以及提供的 PHP 版本</p>
<table>
<thead>
<tr>
<th></th>
<th>Homestead Version</th>
<th>Box Version</th>
</tr>
</thead>
<tbody>
<tr>
<td>PHP 7.0</td>
<td>3.1.0</td>
<td>0.6.0</td>
</tr>
<tr>
<td>PHP 7.1</td>
<td>4.0.0</td>
<td>1.0.0</td>
</tr>
<tr>
<td>PHP 7.1</td>
<td>5.0.0</td>
<td>2.0.0</td>
</tr>
<tr>
<td>PHP 7.1</td>
<td>6.0.0</td>
<td>3.0.0</td>
</tr>
</tbody>
</table>
<h2 id="提供器的特殊设置" tabindex="-1"><a class="header-anchor" href="#提供器的特殊设置"><span>提供器的特殊设置</span></a></h2>
<h3 id="virtualbox" tabindex="-1"><a class="header-anchor" href="#virtualbox"><span>VirtualBox</span></a></h3>
<p>Homestead 默认将 <code v-pre>natdnshostresolver</code> 设置为 <code v-pre>on</code>。这允许 Homestead 使用主机系统中的 DNS 设置。如果你想重写这行为，你可以在你的 <code v-pre>Homestead.yaml</code> 文件中添加下面这几行：</p>
<div class="language-php line-numbers-mode" data-highlighter="prismjs" data-ext="php" data-title="php"><pre v-pre class="language-php"><code><span class="line">provider<span class="token punctuation">:</span> virtualbox</span>
<span class="line">natdnshostresolver<span class="token punctuation">:</span> off</span>
<span class="line"></span></code></pre>
<div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0"><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="译者署名" tabindex="-1"><a class="header-anchor" href="#译者署名"><span>译者署名</span></a></h2>
<table>
<thead>
<tr>
<th>用户名</th>
<th>头像</th>
<th>贡献</th>
<th>签名</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="http://blog.wangyan.org/" target="_blank" rel="noopener noreferrer">WangYan</a></td>
<td><img src="http://imgcdn.wangyan.org/a/120x120.jpg" alt="120x120.jpg"></td>
<td>翻译</td>
<td><a href="http://blog.wangyan.org/about" target="_blank" rel="noopener noreferrer">About Me</a></td>
</tr>
<tr>
<td><a href="https://learnku.com/users/5350" target="_blank" rel="noopener noreferrer">@JokerLinly</a></td>
<td><img src="https://cdn.learnku.com/uploads/avatars/5350_1481857380.jpg" alt="5350_1481857380.jpg"></td>
<td>Review</td>
<td>Stay Hungry. Stay Foolish.</td>
</tr>
</tbody>
</table>
<hr>
<blockquote>
<p>{note} 欢迎任何形式的转载，但请务必注明出处，尊重他人劳动共创开源社区。</p>
<p>转载请注明：本文档由 Laravel China 社区 <a href="https://laravel-china.org/" target="_blank" rel="noopener noreferrer">laravel-china.org</a> 组织翻译，详见 <a href="https://learnku.com/laravel/t/5756/laravel-55-document-translation-call-come-and-join-the-translation" target="_blank" rel="noopener noreferrer">翻译召集帖</a>。</p>
<p>文档永久地址： <a href="https://learnku.com/docs/laravel" target="_blank" rel="noopener noreferrer">《Laravel 中文文档》</a></p>
</blockquote>
</div></template>


